#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

typedef struct ListNode
{
    int value;
    struct ListNode* next;
}node;


void SLPushFront(node** pphead, int x)
{
    node* newnode = (node*)malloc(sizeof(int));
    if (newnode == NULL)
    {
        perror("malloc fail");
        return NULL;
    }
    newnode->value = x;
    newnode->next = NULL;

    newnode->next = *pphead;
    *pphead = newnode;
}


void print(node* head)
{
    while (head != NULL)
    {
        printf("%d", head->value);
        head = head->next;
    }
}

int find(node* head, int k)
{
    node* cur = head;
    while (k == 1)
    {
        cur = cur->next;
        k -= 1;
    }

    return cur->value;
}


int main()
{
    int n = 0, k = 0;
    scanf("%d", &k);

    node* phead = NULL;
    while (scanf("%d", n) != EOF)
    {
        SLPushFront(&phead, n);
    }

    printf("%d\n", find(phead, k));

    return 0;
}